package com.example.wannerone.myapplication123;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        Button btn_open = (Button) findViewById(R.id.btn_open);
//        MyApplication application = (MyApplication) getApplication();
//        application.setU_id(123);
//        System.out.println("application.getU_id="+application.getU_id());
        btn_open.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                //建立一个意图,参数为（当前的Activity类对象，需要开的的Activity类）
                Intent intent = new Intent(MainActivity.this, Main2Activity.class);
                //启动意图
                startActivity(intent);
            }
        });
    }
}
